from django import template
from djwheel.utils import assert_has_request

register = template.Library()

@register.inclusion_tag('tags/search_form.html', takes_context=True)
def search_form(context):
    assert_has_request(context)
    request = context['request']
    q = request.GET.get('q', '')
    return {
        'q': q,
    }

@register.inclusion_tag('tags/search_result.html', takes_context=True)
def search_result(context):
    assert_has_request(context)
    request = context['request']
    q = request.GET.get('q', '')
    return {
        'q': q,
        'result': [],
    }

